#! /usr/bin/env python
# -*- coding:utf-8 -*-
response.menu = [
    ['直接返回', False, EDITER],
    ]

@check_session
def index():
    " 取得在架商品列表 get onsale list "
#    logger('onsale', sip.taobao.items.onsale.get(fields=['title', 'iid', 'price', 'pic_path', 'location']))
    session.rsp_onsale = sip.taobao.items.onsale.get(fields=['title', 'iid', 'price', 'pic_path', 'location'])['rsp']
    return dict(
        )

@check_session
def add():
    item = sip.taobao.item.get(fields=['title','stuff_status','type','cid','num','price','desc'], nick='tel800810', iid='90caf620f052b33723786b243a531474')
    keys = [i for i in item['rsp']['items'][0].keys()]
    v = ''
    for key in keys:
        v += " %s=item['rsp']['items'][0]['%s'], " % (key, key)
    v = v+" location.city='shanghai',location.state='shanghai', "
    exec('sip.taobao.item.add(%s)') % v
    return dict(
        item = item,
        )

@check_session
def get():
    item = sip.taobao.item.get(fields=['title','stuff_status','type','cid','location.city','location.state','num','price','desc'], nick='tel800810', iid='90caf620f052b33723786b243a531474')
    return dict(
        item = item,
        )
    
